﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Love2DWindow.LoveEmbed
{
    internal static class Win32
    {
        [DllImport("user32.dll", EntryPoint = "MoveWindow")]
        public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int w, int h, bool bRepaint);

        [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
        public static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int Y, int cx, int cy, uint wFlags);

        [DllImport("user32.dll", EntryPoint = "SetParent")]
        public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

        //public static void Move(IntPtr handle, int x, int y, int width, int height, bool isShow)
        //{
         
        //    const short SWP_NOMOVE = 0X2;
        //    const short SWP_NOSIZE = 1;
        //    const short SWP_NOZORDER = 0X4;
        //    const int SWP_SHOWWINDOW = 0x0040;
        //    const int SWP_HIDEWINDOW = 0x0080;
        //    const int SWP_NOSENDCHANGING = 0x0400;
        //    const int SWP_NOACTIVATE = 0x0010; // Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
        //    IntPtr HWND_TOPMOST = IntPtr.Subtract(IntPtr.Zero, 1);
        //    //SetWindowPos(handle, HWND_TOPMOST, x, y, width, height, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE);
        //    SetWindowPos(handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
        //    MoveWindow(handle, x, y, width, height, true);

        //    if (isShow == false)
        //    {
        //        SetWindowPos(handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_HIDEWINDOW);
        //    }
        //}
    }
}
